# /*
#  * @Descripttion: 
#  * @version: V1.0.0
#  * @Author: Maverick
#  * @Date: 2025-03-15 20:18:02
#  * @LastEditors: Maverick
#  * @LastEditTime: 2025-03-15 20:21:12
#  */

CC=gcc
CURRENT_PATH:=$(shell pwd)
SRC_DIR:=$(CURRENT_PATH)/src
INC_DIR:=$(CURRENT_PATH)/include

#注意-I 依赖的头文件
CFLAGS= -Wall -O2 -I$(INC_DIR)
BIN:=test
OBJ:=testb.o testc.o

INSTALL_DIR:=$(CURRENT_PATH)/install

wret:=$(wildcard $(SRC_DIR)/*.c)


.PHONY:all
# 
# 
# 
# $(CC) $(CFLAGS) $^ -o $@ 
#  $^ 所有的依赖OBJ对象  $@:目标产物文件
# 
# $(CC) $(CFLAGS) -c  $<  -o $@
# $< 所有的依赖文件名 $@:中间目标产物.o
# 
all:$(BIN)
$(BIN):$(OBJ)
	@echo $(wret)
	@echo "[1] compile dependency :$^ ,over on :$(shell date)\n"
	$(CC) $(CFLAGS) $^ -o $@
%.o:$(SRC_DIR)/%.c
	@echo "[0] compile begin will compile somefiles:$<,at $(shell date)\n"
	$(CC) $(CFLAGS) -c  $<  -o $@


.PHONY:clean
clean:
	rm -rf  $(BIN) $(OBJ)

.PHONY:install
install:
	mkdir -p $(INSTALL_DIR)
	cp $(BIN) $(INSTALL_DIR)

.PHONY:uninstall
uninstall:
	rm -rf $(INSTALL_DIR)
